home *** CD-ROM | disk | FTP | other *** search
- /*pascal format string functions Written by: Eric J. Hayes*/
-
- #include "wdef_pStr.h"
-
- /*protos*/
- void pStrCpy(char*,char*);
- void pStrCat(char*,char*);
- void pRightJust(char*,int);
-
- void pStrCpy(outStr,inStr)
- char * inStr;
- char * outStr;
- {
- int xx;
- int in = inStr[0] & 0x00FF;
- int out = outStr[0] & 0x00FF;
-
- for (xx=0; xx<=in; xx++)
- outStr[xx] = inStr[xx];
- }
-
- void pStrCat(outStr,inStr)
- char * inStr;
- char * outStr;
- {
- int xx;
- int in = inStr[0] & 0x00FF;
- int out = outStr[0] & 0x00FF;
-
- if ( (in + out) > 255 ) /*make sure there is enough room*/
- in = 255 - out;
-
- for (xx=1; xx<=in; xx++)
- outStr[out+xx] = inStr[xx];
-
- outStr[0] = out+in;
- }
-
- void pRightJust(theStr,places)
- char * theStr;
- int places;
- {
- Str255 tempStr;
- int theOffset;
- int xx;
-
- if ( theStr[0] < places )
- {
- pStrCpy((char*)tempStr,(char*)theStr);
- theOffset = places - theStr[0];
- theStr[0] = places;
- for(xx=1 ;xx<=places ;theStr[xx++] = '0');
- for(xx=1 ;xx<=theStr[0] ;theStr[xx+theOffset] = tempStr[xx++]);
- }
- }
-
-